package org.lisa.crm.controller.customer;

import org.lisa.crm.common.util.Result;
import org.lisa.crm.framework.context.BaseController;
import org.lisa.crm.model.CustomerOrder;
import org.lisa.crm.service.CustomerOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2018/2/2.
 */

/*
//customer_order/queryOrdersByCid?cid=${customer.id}">
 */
@Controller
@RequestMapping("/customer_order")
public class CustomerOrderController extends BaseController {

    @Autowired
    private CustomerOrderService customerOrderService;

    @RequestMapping("queryOrdersByCid")
    @ResponseBody
    public Map<String,Object> queryOrdersByCid(int cid, @RequestParam(defaultValue = "1") Integer page,
                                               @RequestParam(defaultValue = "10") Integer rows){

        return customerOrderService.queryOrdersByCid(cid,page,rows);

    }



    @RequestMapping("queryCustoemrOrderByOrderId")
    @ResponseBody
    //"/customer_order/queryCustoemrOrderByOrderId"  orderId
    public Result<CustomerOrder> queryCustoemrOrderByOrderId(int orderId){

        return customerOrderService.queryCustoemrOrderByOrderId(orderId);

    }

    //queryOrderDetailsByOrderId
    @RequestMapping("queryOrderDetailsByOrderId")
    @ResponseBody
    public Map<String,Object>  queryOrderDetailsByOrderId(@RequestParam("orderId") Integer orderId,
                                                          @RequestParam(defaultValue = "1") Integer page,
                                                          @RequestParam(defaultValue = "10") Integer rows){

        return customerOrderService.queryOrderDetailsByOrderId(orderId,page,rows);

    }
}
